<template>
	<view class="" style="position: relative;height: 100vh;">

		<view class="container" style="padding: 24rpx;box-sizing: border-box;background-color: #FFFFFF;
		height: 90vh;">

			<view
				style="margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: column;justify-content: center;align-items: flex-start;">
				<text style="font-size: 28rpx;color: #374151;margin-bottom: 6rpx;">编号</text>
				<input type="text" v-model="id"
					style="padding: 0 32rpx;border-radius: 8rpx;width: 100%;height: 92rpx;border: 2rpx solid #E5E7EB;box-sizing: border-box;"
					placeholder-style="font-size:28rpx;color:#9CA3AF;">
			</view>


			<view
				style="margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: column;justify-content: center;align-items: flex-start;">
				<text style="font-size: 28rpx;color: #374151;margin-bottom: 6rpx;">名称</text>
				<input type="text" v-model="name"
					style="padding: 0 32rpx;border-radius: 8rpx;width: 100%;height: 92rpx;border: 2rpx solid #E5E7EB;box-sizing: border-box;"
					placeholder-style="font-size:28rpx;color:#9CA3AF;">
			</view>


			<view
				style="margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: column;justify-content: center;align-items: flex-start;">
				<text style="font-size: 28rpx;color: #374151;margin-bottom: 6rpx;">一页显示商品数</text>
				<input type="number" v-model="page_size"
					style="padding: 0 32rpx;border-radius: 8rpx;width: 100%;height: 92rpx;box-sizing: border-box;border: 2rpx solid #E5E7EB;"
					placeholder-style="font-size:28rpx;color:#9CA3AF;">
			</view>


			<view
				style="margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: column;justify-content: center;align-items: flex-start;">
				<text style="font-size: 28rpx;color: #374151;margin-bottom: 6rpx;">备注</text>
				<textarea type="text" v-model="remark"
					style="padding: 10rpx 32rpx;border-radius: 8rpx;width: 100%;height: 200rpx;border: 2rpx solid #E5E7EB;box-sizing: border-box;"
					placeholder-style="font-size:28rpx;color:#9CA3AF;"></textarea>
			</view>

			<view
				style="border-radius: 8rpx;border: 2rpx solid #E5E7EB;height: 92rpx;margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: row;justify-content: space-between ;align-items: center;">
				<text style="font-size: 28rpx;color: #374151;margin-left: 10rpx;">商品图是否使用广告图</text>
				<switch checked @change="showBannerChange" />
			</view>

			<view
				style="border-radius: 8rpx;border: 2rpx solid #E5E7EB;height: 92rpx;margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: row;justify-content: space-between ;align-items: center;">
				<text style="font-size: 28rpx;color: #374151;margin-left: 10rpx;">是否启用</text>
				<switch checked @change="statusChange" />
			</view>

			<view
				style="border-radius: 8rpx;border: 2rpx solid #E5E7EB;height: 92rpx;margin-bottom: 32rpx;width: 100%;display: flex;flex-direction: row;justify-content: space-between ;align-items: center;">
				<text style="font-size: 28rpx;color: #374151;margin-left: 10rpx;">是否可支持多页查询</text>
				<switch checked @change="pageEnablerChange" />
			</view>
		</view>

		<view class=""
			style="width: 100%;background-color: #F9FAFB;box-sizing: border-box;padding: 32rpx;height: 152rpx;display: flex;justify-content: space-evenly;align-items: center;position: absolute;bottom: 0;left: 0;">
			<view class="" @click="save"
				style="border-radius: 8rpx;width: 45%;height: 100%;background-color:  #FF4D4F;line-height: 152rpx;color: #FFFFFF;display: flex;justify-content: center;align-items: center">
				保存
			</view>
			<view class=""
				style="border-radius: 8rpx;width: 45%;height: 100%;border: 1px solid #FF4D4F;line-height: 152rpx;display: flex;justify-content: center;align-items: center;color:#FF4D4F ;">
				取消
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
		mapGetters
	} from 'vuex';
	export default {
		components: {

		},
		data() {
			return {
				id:"",
				name: "",
				page_size: 4,
				page_enable: false,
				show_banner: true,
				remark: "",
				status: "1"
			};
		},
		computed: {
			...mapGetters(['inviteCode', 'uid']),


		},

		onLoad(e) {

		},
		methods: {
			//提价基本信息
			save() {

				var bodyParam = {
					...this._data
				}

				this.$pin.request('POST', `/shop/template/type`, bodyParam, successData => {
					console.log(successData)
					if (successData.code == 2000) {
						uni.showToast({
							title: '设置成功'
						})

					} else {
						uni.showToast({
							title: '设置失败',
							icon: 'none'
						})
					}
				}, failData => {
					console.log(failData)
					uni.showToast({
						title: '设置失败',
						icon: 'none'

					})
				})


			},
			showBannerChange(e){
				this.show_banner = e.detail.value;
				
			},
			
			statusChange(e){
				this.status = e.detail.value?"1":"0"
		
			},
			
			pageEnablerChange(e){
				this.page_enable = e.detail.value;
				
			}

		}
		
		

	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100%;
		background: #ededed;
	}

	.container {
		padding: 20rpx;
		box-sizing: border-box;
		position: relative;


		.product-list {
			width: 100%;
			// padding: 0 2% 3vw 2%;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;

			.product {
				padding: 20rpx;
				box-sizing: border-box;
				width: 100%;
				background-color: #fff;
				margin: 0 0 15upx 0;
				border-radius: $pin-border-radius;
				box-shadow: $pin-shadow;
				// height: 499rpx;
			}
		}
	}

	.s-add-list-btn-icon {
		font-size: 80rpx;
		height: 80rpx;
		line-height: 80rpx;
		margin-bottom: 20rpx;
		color: #999;
	}
</style>